package com.busionline.wotu.woochenandroid.tools;

import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;

import com.busionline.wotu.woochenandroid.R;
import com.busionline.wotu.woochenandroid.WoochenApplication;

/**
 *字符串工具类
 *@author woochen123
 *@time 2018/5/16 15:08
 *@desc
 */

public class StringUtil {

    /**
     *给目标字符串设置前景色
     * @param source
     * @return
     */
    public static CharSequence getSpanText(String source) {
        Spannable mSpan = new SpannableString(source);
        mSpan.setSpan(new ForegroundColorSpan(ContextCompat.getColor(WoochenApplication.mContext, R.color._0091ea)), 0, source.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
        return mSpan;
    }
}
